<template>
    <el-image :fit="props.fit" :class="props.class" :src="props.src" @click="props?.click?.(props.src)">
        <template #error>
            <div class="image-slot">
                <el-image fit="cover" :class="props.class" :src="Constant.default_image" />
            </div>
        </template>
    </el-image>
</template>

<script lang='ts' setup>
import Constant from "@/common/Constant";

type Props = {
    src: string,
    class: any,
    fit?: '' | 'fill' | 'contain' | 'cover' | 'none' | 'scale-down',
    click?: Function,
};

const props = withDefaults(defineProps<Props>(), {
    fit: 'contain',
});
</script>

<style lang='scss' scoped></style>